package com.clkj.xiuzheng.dao;

import com.clkj.xiuzheng.pojo.ProductStock;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

@Repository
public interface ProductStocksMapper extends Mapper<ProductStock> {
    @Select("select s.*,p.product_name,a.warehouse_name from t_cl_productStock s " +
            "left  JOIN t_cl_product p on s.product_id=p.product_id " +
            "left join t_cl_warehouse a on s.warehouse_id = a.warehouse_id " +
            "WHERE a.company_id = #{companyId} and " +
            "product_name  like '%${productStockName}%'  ")
    List<ProductStock> listProductStock(String productStockName,Integer companyId);

    @Select("select warehouse_name from t_cl_warehouse where warehouse_id = #{warehouseId}")
    String getWarehouseNameById(@Param("warehouseId") Integer warehouseId);
}
